/**
 * @project_name staff_vehicle
 * @package_name com.ssh.ser.fcvm
 * @desc TODO
 * @param
 * @author jack
 * @date 2013-4-25
 * @time 上午11:17:47
 */
package com.ssh.backup;

import java.sql.Timestamp;
import java.util.List;

import com.ssh.dao.FcarCardDAOI;
import com.ssh.dao.FcarInoutDAOI;
import com.ssh.entity.FcarInout;

/**
 * @author jack
 *
 */
public class FVehicleMSerImpl implements FVehicleMSerI {
	private FcarInoutDAOI fcarInoutDAOI ;
	private FcarCardDAOI  fcarCardDAOI ;

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#getIn(com.ssh.entity.FcarInout)
	 */
	@Override
	public int getIn(FcarInout fcarInout) {
		// TODO Auto-generated method stub
		try{
			fcarInoutDAOI.addFcarInout(fcarInout);
		}
		catch(Exception e){
			return 0 ;
		}

		return 1;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#getout(com.ssh.entity.FcarInout)
	 */
	@Override
	public int getout(FcarInout fcarInout) {
		// TODO Auto-generated method stub
		try{
			fcarInout = fcarInoutDAOI.queryLatestIn(fcarInout.getFcarCardId());
			fcarInoutDAOI.updateByFcarInout(fcarInout);
		}
		catch(Exception e){
			return 0 ;
		}

		return 1;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#view(com.ssh.entity.FcarInout)
	 */
	@Override
	public FcarInout viewByInTime(FcarInout fcarInout) {
		// TODO Auto-generated method stub
		try{
			return fcarInoutDAOI.queryByInTime(fcarInout.getGetIn());
		}
		catch(Exception e){
			return null ;
		}
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#view(java.lang.String, java.sql.Timestamp)
	 */
	@Override
	public List<FcarInout> view(String fcardId, Timestamp getInTime) {
		// TODO Auto-generated method stub
		fcarInoutDAOI.queryByInTime(fcardId, getInTime);
		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#view(java.lang.String, java.sql.Timestamp, java.sql.Timestamp)
	 */
	@Override
	public List<FcarInout> view(String fCardId, Timestamp getInTime, Timestamp getOutTime) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#viewByOutTime(com.ssh.entity.FcarInout)
	 */
	@Override
	public List<FcarInout> viewByOutTime(FcarInout fcarInout) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#viewLaestRecord(java.lang.String)
	 */
	@Override
	public FcarInout viewLaestOutRecord(String fcardId) {
		// TODO Auto-generated method stub
			return fcarInoutDAOI.queryLatestOut(fcardId);
	}
	@Override
	public FcarInout viewLaestInRecord(String fcardId) {
		// TODO Auto-generated method stub
			return fcarInoutDAOI.queryLatestOut(fcardId);
	}

	/* (non-Javadoc)
	 * @see com.ssh.ser.fcvm.FVehicleMSerI#viewLaestRecord(java.lang.String)
	 */
	@Override
	public FcarInout viewLaestRecord(String fcardId) {
		// TODO Auto-generated method stub
		 return fcarInoutDAOI.queryLatestOut(fcardId);
	}
}
